home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_13.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
12KB
|
445 lines
function spawnBoss()
{
for(leftovers in enemyContainer)
{
explode(enemyContainer[leftovers]);
}
music.level.stop();
music.boss.start(0,999);
attachMovie("boss.core","boss",bossDepth);
boss._x = Stage.width / 2;
boss.red.gotoAndStop(1);
boss.orangeL.gotoAndStop(1);
boss.orangeR.gotoAndStop(1);
boss.yellowL.gotoAndStop(1);
boss.yellowR.gotoAndStop(1);
boss.center.gotoAndStop(1);
boss.center.shoot = centerShoot;
boss._y = int((- boss._height) / 2);
boss.onEnterFrame = bossExecute;
boss.move = bossMover;
boss.state = 0;
boss.emerger = 0;
boss.energy = 300;
boss.hit = false;
boss.arm1 = boss.red;
boss.arm1.shoot = redShoot;
boss.arm2 = boss.yellowL;
boss.arm3 = boss.yellowR;
boss.arm2.shoot = boss.arm3.shoot = yellowShoot;
boss.arm4 = boss.orangeL;
boss.arm5 = boss.orangeR;
boss.arm4.shoot = boss.arm5.shoot = orangeShoot;
i = 1;
while(i <= 5)
{
eval("boss.arm" + i).hit = false;
eval("boss.arm" + i).energy = 75;
eval("boss.arm" + i).explode = bossArmExplode;
eval("boss.arm" + i).firing = false;
eval("boss.arm" + i).alive = false;
eval("boss.arm" + i).hitCheck = armHitCheck;
i++;
}
boss.t = 0;
boss.s = boss._y;
boss.c = 144;
boss.d = 30;
}
function bossExecute()
{
this.move();
var i = 1;
while(i <= 5)
{
var arm = eval("boss.arm" + i);
if(arm.hit)
{
arm.resetColor();
arm.hit = false;
}
i++;
}
if(this.state < 10)
{
if(this.arm1.alive)
{
this.arm1.hitCheck();
}
if(this.arm2.alive)
{
this.arm2.hitCheck();
}
if(this.arm3.alive)
{
this.arm3.hitCheck();
}
if(this.arm4.alive)
{
this.arm4.hitCheck();
}
if(this.arm5.alive)
{
this.arm5.hitCheck();
}
}
else
{
if(this.hit)
{
this.resetColor();
this.hit = false;
}
for(tpb in pBullets)
{
var cap = pBullets[tpb];
if(this.hitTest(cap._x,cap._y,false))
{
this.hit = true;
this.setRGB(16777215);
this.energy -= 5;
cap.removeMovieClip();
if(this.energy <= 0)
{
bossExplode();
}
return undefined;
}
}
}
}
function armHitCheck()
{
for(tpb in pBullets)
{
var cap = pBullets[tpb];
if(this.ha.hitTest(cap._x,cap._y,false))
{
this.hit = true;
this.setRGB(16777215);
this.energy -= 5;
if(this.energy <= 0)
{
this.explode(cap._x,cap._y);
this.gotoAndStop(1);
this.alive = false;
var allArmsGone = true;
var i = 1;
while(i <= 5)
{
if(eval("boss.arm" + i)._currentframe != 1)
{
allArmsGone = false;
}
i++;
}
if(allArmsGone)
{
boss.t = 0;
boss.state = 10;
boss.center.gotoAndPlay("emerge");
}
}
cap.removeMovieClip();
return undefined;
}
}
}
function bossArmExplode(xSpot, ySpot)
{
var _loc1_ = this;
var xInc = (boss._x + _loc1_._x - xSpot) / 3;
var yInc = (boss._y + _loc1_._y - ySpot) / 3;
var _loc3_ = 0;
while(_loc3_ < 3)
{
var _loc2_ = explosionContainer.attachMovie("explosion2","explosion" + explosionCount++,explosionCount);
_loc2_._x = xSpot;
_loc2_._y = ySpot;
xSpot += xInc;
ySpot += yInc;
_loc2_.gotoAndStop(1);
_loc2_._visible = false;
_loc2_.delay = _loc3_ * 3;
_loc2_.onEnterFrame = function()
{
var _loc1_ = this;
if(!_loc1_._visible && _loc1_.delay <= 0)
{
_loc1_._visible = true;
_loc1_.gotoAndPlay(1);
playSound("sound.missile.explode");
}
else
{
_loc1_.delay = _loc1_.delay - 1;
}
if(_loc1_._currentframe == _loc1_._totalframes)
{
_loc1_.removeMovieClip();
}
};
_loc3_ = _loc3_ + 1;
}
}
function bossMover()
{
switch(this.state)
{
case 0:
if(this.t < this.d)
{
this.t = this.t + 1;
this._y = Math.easeOutQuad(this.t,this.s,this.c,this.d);
if(this.t == this.d)
{
this.t = -1;
this.state = this.state + 1;
}
}
break;
case 1:
this.t = this.t + 1;
switch(this.t)
{
case 1:
this.yellowR.gotoAndPlay("emerge");
break;
case 6:
this.yellowL.gotoAndPlay("emerge");
break;
case 11:
this.orangeL.gotoAndPlay("emerge");
break;
case 15:
this.red.gotoAndPlay("emerge");
break;
case 21:
this.orangeR.gotoAndPlay("emerge");
break;
case 26:
this.t = 0;
this.state = this.state + 1;
var i = 1;
while(i <= 5)
{
eval("this.arm" + i).alive = true;
eval("this.arm" + i).energy = 50;
i++;
}
}
break;
case 2:
this.t = this.t + 1;
if(this.t > 60)
{
this.t = 0;
this.state = this.state + 1;
}
break;
case 3:
this.t += 0.5;
if(this.t % 1 == 0 && eval("this.arm" + (this.t % 5 + 1)).alive)
{
eval("this.arm" + (this.t % 5 + 1)).gotoAndPlay("fire");
}
if(this.t > 45 || Math.abs(this._x - theHull._x) > 250)
{
this.t = 0;
this.s = this._x;
this.c = theHull._x - this._x;
this.d = Math.floor(Math.abs(this._x - theHull._x) / 3);
this.state = 5;
}
break;
case 4:
if(this.t % 10 == 0 && this.orangeR.alive)
{
this.orangeR.gotoAndPlay("fire");
}
else if(this.t % 10 == 5 && this.orangeL.alive)
{
this.orangeL.gotoAndPlay("fire");
}
this.t = this.t + 1;
if(this.t > 30)
{
this.state = this.state + 1;
this.t = 0;
this.s = this._x;
this.c = theHull._x - this._x;
this.d = Math.floor(Math.abs(this._x - theHull._x) / 3);
}
break;
case 5:
if(this.t < this.d)
{
this.t = this.t + 1;
this._x = Math.easeOutElastic(this.t,this.s,this.c,this.d);
}
if(this.t == this.d)
{
this.state = 2;
}
break;
case 10:
this.t = this.t + 1;
if(this.t % 33 == 0)
{
this.center.gotoAndPlay("fire");
}
if(this.t > 100)
{
this.resetColor();
this.state = 1;
this.t = 0;
this.center.gotoAndPlay("retract");
}
}
}
function bossExplode()
{
var _loc1_ = this;
playSound("sound.boss.explode");
var _loc2_ = explosionContainer.attachMovie("explosion4","explosion" + explosionCount++,explosionCount);
_loc2_._x = boss._x;
_loc2_._y = boss._y;
_loc2_.onEnterFrame = function()
{
var _loc1_ = this;
if(_loc1_._currentframe == _loc1_._totalframes)
{
attachMovie("codeModulator","codeModulator",4999);
codeModulator._x = _loc1_._x;
codeModulator._y = _loc1_._y;
codeModulator.sinThing = 0;
codeModulator.onEnterFrame = function()
{
var _loc1_ = this;
_loc1_.sinThing += 0.1;
_loc1_._y += Math.sin(_loc1_.sinThing);
if(theHull.hitTest(_loc1_))
{
music.boss.stop();
playSound("sound.powerup");
music.intro.start(0,999);
endLevel();
_loc1_.removeMovieClip();
}
};
_loc1_.removeMovieClip();
}
};
boss.removeMovieClip();
}
function centerShoot()
{
var _loc2_ = this;
var _loc1_ = eBullets.attachMovie("eBul1","bullet" + eBulletsCount++,eBulletsCount);
_loc1_._x = boss._x;
_loc1_._y = boss._y + 31;
_loc1_.vel = new Vector(theHull._x - _loc1_._x,theHull._y - _loc1_._y);
_loc1_.vel.setLength(8);
_loc1_.onEnterFrame = function()
{
var _loc1_ = this;
_loc1_._x += _loc1_.vel.x;
_loc1_._y += _loc1_.vel.y;
if(_loc1_._y > 400)
{
_loc1_.removeMovieClip();
}
};
}
function bossProjectileMove()
{
var _loc1_ = this;
if(_loc1_.isHit)
{
_loc1_.resetColor();
_loc1_.isHit = false;
}
if(_loc1_.energy <= 0)
{
playSound("sound.missile.explode",(_loc1_._x - 300) / 6);
explode(_loc1_);
}
else
{
_loc1_._y += 8;
if(_loc1_._y > 400)
{
_loc1_.removeMovieClip();
}
}
}
function redShoot()
{
var _loc1_ = misCon.attachMovie("missile3","missile" + misCount++,misCount);
var _loc2_ = new Object();
_loc2_.x = this._x + 62;
_loc2_.y = this._y + 81;
boss.localToGlobal(_loc2_);
_loc1_._x = _loc2_.x;
_loc1_._y = _loc2_.y;
_loc1_.move = bossProjectileMove;
_loc1_.isHit = false;
_loc1_.Q1logic = missileQ1;
_loc1_.Q2logic = missileQ2;
_loc1_.Q3logic = missileQ3;
_loc1_.Q4logic = missileQ4;
_loc1_.energy = 5;
}
function yellowShoot(leftSide)
{
var _loc3_ = this;
var _loc1_ = misCon.attachMovie("missile4","missile" + misCount++,misCount);
var _loc2_ = new Object();
if(leftSide)
{
_loc2_.x = _loc3_._x - 61 + 14;
_loc2_.y = _loc3_._y + 80 + 27;
}
else
{
_loc2_.x = _loc3_._x + 29 + 14;
_loc2_.y = _loc3_._y + 43 + 27;
}
boss.localToGlobal(_loc2_);
_loc1_._x = _loc2_.x;
_loc1_._y = _loc2_.y;
_loc1_.move = bossProjectileMove;
_loc1_.isHit = false;
_loc1_.Q1logic = missileQ1;
_loc1_.Q2logic = missileQ2;
_loc1_.Q3logic = missileQ3;
_loc1_.Q4logic = missileQ4;
_loc1_.energy = 5;
}
function orangeShoot(leftSide)
{
var _loc3_ = this;
var _loc1_ = misCon.attachMovie("boss.warhead","missile" + misCount++,misCount);
var _loc2_ = new Object();
if(leftSide)
{
_loc2_.x = _loc3_._x - 32 + 8;
_loc2_.y = _loc3_._y + 85 + 8;
}
else
{
_loc2_.x = _loc3_._x + 15 + 11;
_loc2_.y = _loc3_._y + 93 + 11;
}
boss.localToGlobal(_loc2_);
_loc1_._x = _loc2_.x;
_loc1_._y = _loc2_.y;
_loc1_.move = bossProjectileMove;
_loc1_.isHit = false;
_loc1_.Q1logic = missileQ1;
_loc1_.Q2logic = missileQ2;
_loc1_.Q3logic = missileQ3;
_loc1_.Q4logic = missileQ4;
_loc1_.energy = 5;
}